package kpi.java_training.testing.questions;

import kpi.java_training.testing.education.TypeScore;
import kpi.java_training.testing.services.StringServices;

/**
 * class for generic question
 */
abstract public class Question {
    public static final int STRING = 1;
    public static final int INTEGER = 2;
    public static final int MANY_FROM_MANY = 3;
    private String questionMessage;
    private String originalAnswer;
    protected int level;

    public Question(String questionMessage) {
        this.questionMessage = questionMessage;
    }

    abstract protected String getQuestionHelp();

    abstract protected int getQuestionType();

    @Override
    public String toString() {
        return StringServices.makeString(getQuestionHelp(), getQuestionMessage());
    }
    public int getLevel() {
        return level;
    }
    protected String getQuestionMessage() {
        return questionMessage;
    }

    abstract public boolean isCorrect();

    public void setAnswer(String answer) {
        setOriginalAnswer(answer);
    }

    protected void setOriginalAnswer(String answer) {
        originalAnswer = answer;
    }

    abstract public void clearAnswer();
    public String getQuestionSaveData() {
        return StringServices.makeString(Integer.toString(getQuestionType()), getQuestionMessage());
    }

    public String getAnswerSaveData() {
        return originalAnswer;
    }
}
